package com.company.lifecycleCallbacks;

import com.company.bean.Student;
import com.config.AppConfig;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.stereotype.Component;

/**
 * @Author: zhaopeng
 * @Date: Created in 9:54 2020/9/29
 * @Modified By:
 */
@Component
public class LifecycleCallBacks {

	public static void add(BeanFactoryPostProcessor beanPostProcessor) {

	}
	public static void main(String[] args) {
		AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(AppConfig.class);
		Student student = ac.getBean("student", Student.class);
		System.out.println(student);
		ac.close();
		System.out.println("销毁之后" + ac.containsBean("student"));
//		LifecycleCallBacks.add(i -> {
//			i.getBeanDefinition("");
//		});

		// 生命周期顺序 定义完beanDefinition(springBean加载信息) -> beanFactoryPostProcessor -> 创建javaBean对象 ->
		// 创建springBean对象 -> beanFactoryPostProcessor(postProcessBeforeInitialization) -> PostConstruct ->
		// beanFactoryPostProcessor(postProcessAfterInitialization) -> preDestroy -> DisposableBean
	}
}
